<?php
$id=$_GET["id"]*1;
if(empty($buid)){
	msg($config['weburl']."/login.php?forward=".urlencode($config['weburl']."?m=product&s=mobile_question&id=".$param['pid']));
}
$param = $_POST;
//var_dump($param);exit;
if($param){
		$sql = "select * from ".PRO." where id = '{$param['pid']}' ";
	$db->query($sql);
	$product_info = $db->fetchRow();
	if(empty($product_info)){
	msg($config['weburl']."?m=product&s=mobile_question&id=".$param['pid'],'票品不存在');
	return false;
	}
	
	$usql = "select * from ".MEMBER." where userid = '$buid' ";
	$db->query($usql);
	$member_info = $db->fetchRow();
	if(empty($member_info)){
		msg($config['weburl']."?m=product&s=mobile_question&id=".$param['pid'],'用户不存在');
	return false;
	}
	$time = time();
	$isql = "insert into ".QUESTION." (`catid`,`product_id`,`product_name`,`member_id`,`member_name`,`question`,`question_time`,`status`)
	values ('{$product_info['catid']}','{$product_info['id']}','{$product_info['pname']}','{$member_info['userid']}','{$member_info['user']}','{$param['content']}','$time','1')";
	if($db->query($isql)){
		msg($config['weburl']."?m=product&s=detail&id=".$param['pid']);
	return false;
	} else {
		msg($config['weburl']."?m=product&s=mobile_question&id=".$param['pid'],'提交失败');
	return false;
	}
}



//======================================

$tpl->assign("id",$id);
include_once("footer.php");
$out=tplfetch("mobile_question.htm","");

?>